Computes the magnitude of a quaternion.
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| type(quaternion), | intent(in) | :: | q |
The quaternion. |
The magnitude of the quaternion.
Returns the imaginary component of the quaternion.
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| type(quaternion), | intent(in) | :: | q |
The quaternion. |
The imaginary component as a vector.
Assigns a quaternion to another.
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| type(quaternion), | intent(out) | :: | x |
The resulting quaternion. |
||
| type(quaternion), | intent(in) | :: | y |
The source quaternion. |
Assigns a 4-element vector to a quaternion.
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| type(quaternion), | intent(out) | :: | x |
The resulting quaternion. |
||
| real(kind=real64), | intent(in), | dimension(4) | :: | y |
The source vector. |
Computes the conjugate of a quaternion.
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| type(quaternion), | intent(in) | :: | q |
The quaternion. |
The conjugate of the quaternion.
Computes the dot product of two quaternions.
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| type(quaternion), | intent(in) | :: | x |
The left-hand-side argument. |
||
| type(quaternion), | intent(in) | :: | y |
The right-hand-side argument. |
The dot product.
Evaluates the exponential function for a quaternion.
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| type(quaternion), | intent(in) | :: | q |
The quaternion. |
The resulting quaternion.
Evalautes the natural logarithm function for a quaternion.
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| type(quaternion), | intent(in) | :: | q |
The quaternion. |
The resulting quaternion.
Multiplies a quaternion with a scalar.
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| type(quaternion), | intent(in) | :: | x |
The quaternion. |
||
| real(kind=real64), | intent(in) | :: | y |
The scalar. |
The resulting quaternion.
Multiplies a quaternion with a scalar.
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| real(kind=real64), | intent(in) | :: | x |
The scalar. |
||
| type(quaternion), | intent(in) | :: | y |
The quaternion. |
The resulting quaternion.
Multiplies two quaternions.
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| type(quaternion), | intent(in) | :: | x |
The left-hand-side argument. |
||
| type(quaternion), | intent(in) | :: | y |
The right-hand-side argument. |
The resulting quaternion.
Multiplies a quaternion with a 3-element vector.
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| type(quaternion), | intent(in) | :: | x |
The quaternion. |
||
| real(kind=real64), | intent(in), | dimension(3) | :: | y |
The vector. |
The resulting quaternion.
Computes the result of a quaternion raised to an exponent.
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| type(quaternion), | intent(in) | :: | q |
The quaternion base. |
||
| real(kind=real64), | intent(in) | :: | exponent |
The exponent. |
The resulting quaternion.
Computes the result of a quaternion raised to an exponent.
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| type(quaternion), | intent(in) | :: | q |
The quaternion base. |
||
| integer(kind=int32), | intent(in) | :: | exponent |
The exponent. |
The resulting quaternion.
Adds two quaternions together.
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| type(quaternion), | intent(in) | :: | x |
The left-hand-side argument. |
||
| type(quaternion), | intent(in) | :: | y |
The right-hand-side argument. |
The resulting quaternion.
Subtracts two quaternions.
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| type(quaternion), | intent(in) | :: | x |
The left-hand-side argument. |
||
| type(quaternion), | intent(in) | :: | y |
The right-hand-side argument. |
The resulting quaternion.
Negates a quaternion.
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| type(quaternion), | intent(in) | :: | x |
The quaternion. |
The resulting quaternion.
Divides a quaternion by a scalar.
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| type(quaternion), | intent(in) | :: | x |
The quaternion. |
||
| real(kind=real64), | intent(in) | :: | y |
The scalar. |
The resulting quaternion.
Divides a quaternion by another.
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| type(quaternion), | intent(in) | :: | x |
The left-hand-side argument. |
||
| type(quaternion), | intent(in) | :: | y |
The right-hand-side argument. |
The resulting quaternion.
Constructs a quaternion from a 4-element array stored such that [w, x, y, z].
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| real(kind=real64), | intent(in), | dimension(4) | :: | x |
The array from which to initialize the quaternion stored in the order [w, x, y, z]. |
The resulting quaternion.
Constructs a quaternion given an axis and the angle of rotation about the axis.
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| real(kind=real64), | intent(in) | :: | angle |
The rotation angle, in radians. |
||
| real(kind=real64), | intent(in), | dimension(3) | :: | axis |
A 3-element vector defining the axis about which the rotation occurrs. |
The resulting quaternion.
Constructs a quaternion from a 3-by-3 rotation matrix using the Stanley method.
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| real(kind=real64), | intent(in), | dimension(3, 3) | :: | r |
The rotation matrix. |
The resulting quaternion.
Returns the real component of the quaternion.
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| type(quaternion), | intent(in) | :: | q |
The quaternion. |
The real component.
Defines a quaternion of the form:
| Type | Visibility | Attributes | Name | Initial | |||
|---|---|---|---|---|---|---|---|
| real(kind=real64), | public | :: | w |
The real component of the quaternion. |
|||
| real(kind=real64), | public | :: | x |
The first element in the imaginary component of the quaternion. |
|||
| real(kind=real64), | public | :: | y |
The second element in the imaginary component of the quaternion. |
|||
| real(kind=real64), | public | :: | z |
The third element in the imaginary component of the quaternion. |
| private pure function quat_init_array (x) | Constructs a quaternion from a 4-element array stored such that [w, x, y, z]. |
| private pure function quat_init_angle_axis (angle, axis) | Constructs a quaternion given an axis and the angle of rotation about the axis. |
| private pure function quat_init_mtx (r) | Constructs a quaternion from a 3-by-3 rotation matrix using the Stanley method. |
| procedure , public :: normalize => quat_normalize Subroutine | |
| procedure , public :: to_angle_axis => quat_to_angle_axis Subroutine | |
| procedure , public :: to_array => quat_to_vec4 Function | |
| procedure , public :: to_matrix => quat_to_matrix Function | |
| procedure , public :: to_roll_pitch_yaw => quat_to_rpy Subroutine |
Computes the inverse of a quaternion.
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| type(quaternion), | intent(in) | :: | q |
The quaternion. |
The inverse of the supplied quaternion.